#include "..\define.h"
#include "GameObject.h"
#include "..\SceneManager\SceneManager.h"
#include "..\ApplicationManager.h"

GameObject::GameObject() 
{
}

GameObject::~GameObject()
{
}

//----------------------------------------------------- public
void GameObject::InitObject(Ogre::SceneNode* node, Ogre::Entity* entity, Ogre::Vector3 position )
{
    node_    = node;
    entity_ = entity;
    node_->setPosition(position);
    node_->attachObject(entity_);

    Ogre::LogManager::getSingletonPtr()->logMessage("*** GameObject ***");
    size_t windowHnd = 0;
    std::ostringstream windowHndStr;
    OIS::ParamList pl;
    _singleton_application.getWindow()->getCustomAttribute("WINDOW", &windowHnd);
    windowHndStr << windowHnd;
    pl.insert(std::make_pair(std::string("WINDOW"), windowHndStr.str()));
    input_manager_ = OIS::InputManager::createInputSystem(pl);
    key_board_ = static_cast<OIS::Keyboard*>(input_manager_->createInputObject
                                              (OIS::OISKeyboard, true));
    mouse_ = static_cast<OIS::Mouse*>(input_manager_->createInputObject( OIS::OISMouse, true ));

    key_board_->setEventCallback(this);
    mouse_->setEventCallback(this);


}